3.4.72 \(\int (b \cos (c+d x))^n (A+B \cos (c+d x)+C \cos ^2(c+d x)) \, dx\) [372]

3.4.72.1 Optimal result
3.4.72.2 Mathematica [A] (verified)
3.4.72.3 Rubi [A] (verified)
3.4.72.4 Maple [F]
3.4.72.5 Fricas [F]
3.4.72.6 Sympy [F]
3.4.72.7 Maxima [F]
3.4.72.8 Giac [F]
3.4.72.9 Mupad [F(-1)]

3.4.72.1 Optimal result

Integrand size = 31, antiderivative size = 187 \[ \int (b \cos (c+d x))^n \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \, dx=\frac {C (b \cos (c+d x))^{1+n} \sin (c+d x)}{b d (2+n)}-\frac {(C (1+n)+A (2+n)) (b \cos (c+d x))^{1+n} \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {1+n}{2},\frac {3+n}{2},\cos ^2(c+d x)\right ) \sin (c+d x)}{b d (1+n) (2+n) \sqrt {\sin ^2(c+d x)}}-\frac {B (b \cos (c+d x))^{2+n} \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {2+n}{2},\frac {4+n}{2},\cos ^2(c+d x)\right ) \sin (c+d x)}{b^2 d (2+n) \sqrt {\sin ^2(c+d x)}} \]

output
C*(b*cos(d*x+c))^(1+n)*sin(d*x+c)/b/d/(2+n)-(C*(1+n)+A*(2+n))*(b*cos(d*x+c 
))^(1+n)*hypergeom([1/2, 1/2+1/2*n],[3/2+1/2*n],cos(d*x+c)^2)*sin(d*x+c)/b 
/d/(1+n)/(2+n)/(sin(d*x+c)^2)^(1/2)-B*(b*cos(d*x+c))^(2+n)*hypergeom([1/2, 
 1+1/2*n],[2+1/2*n],cos(d*x+c)^2)*sin(d*x+c)/b^2/d/(2+n)/(sin(d*x+c)^2)^(1 
/2)
 
3.4.72.2 Mathematica [A] (verified)

Time = 0.23 (sec) , antiderivative size = 144, normalized size of antiderivative = 0.77 \[ \int (b \cos (c+d x))^n \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \, dx=\frac {(b \cos (c+d x))^n \cot (c+d x) \left (-\left ((C (1+n)+A (2+n)) \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {1+n}{2},\frac {3+n}{2},\cos ^2(c+d x)\right ) \sqrt {\sin ^2(c+d x)}\right )+(1+n) \left (C \sin ^2(c+d x)-B \cos (c+d x) \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {2+n}{2},\frac {4+n}{2},\cos ^2(c+d x)\right ) \sqrt {\sin ^2(c+d x)}\right )\right )}{d (1+n) (2+n)} \]

input
Integrate[(b*Cos[c + d*x])^n*(A + B*Cos[c + d*x] + C*Cos[c + d*x]^2),x]
 
output
((b*Cos[c + d*x])^n*Cot[c + d*x]*(-((C*(1 + n) + A*(2 + n))*Hypergeometric 
2F1[1/2, (1 + n)/2, (3 + n)/2, Cos[c + d*x]^2]*Sqrt[Sin[c + d*x]^2]) + (1 
+ n)*(C*Sin[c + d*x]^2 - B*Cos[c + d*x]*Hypergeometric2F1[1/2, (2 + n)/2, 
(4 + n)/2, Cos[c + d*x]^2]*Sqrt[Sin[c + d*x]^2])))/(d*(1 + n)*(2 + n))
 
3.4.72.3 Rubi [A] (verified)

Time = 0.52 (sec) , antiderivative size = 184, normalized size of antiderivative = 0.98, number of steps used = 6, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.194, Rules used = {3042, 3502, 3042, 3227, 3042, 3122}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int (b \cos (c+d x))^n \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \left (b \sin \left (c+d x+\frac {\pi }{2}\right )\right )^n \left (A+B \sin \left (c+d x+\frac {\pi }{2}\right )+C \sin \left (c+d x+\frac {\pi }{2}\right )^2\right )dx\)

\(\Big \downarrow \) 3502

\(\displaystyle \frac {\int (b \cos (c+d x))^n (b (C (n+1)+A (n+2))+b B (n+2) \cos (c+d x))dx}{b (n+2)}+\frac {C \sin (c+d x) (b \cos (c+d x))^{n+1}}{b d (n+2)}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\int \left (b \sin \left (c+d x+\frac {\pi }{2}\right )\right )^n \left (b (C (n+1)+A (n+2))+b B (n+2) \sin \left (c+d x+\frac {\pi }{2}\right )\right )dx}{b (n+2)}+\frac {C \sin (c+d x) (b \cos (c+d x))^{n+1}}{b d (n+2)}\)

\(\Big \downarrow \) 3227

\(\displaystyle \frac {b (A (n+2)+C (n+1)) \int (b \cos (c+d x))^ndx+B (n+2) \int (b \cos (c+d x))^{n+1}dx}{b (n+2)}+\frac {C \sin (c+d x) (b \cos (c+d x))^{n+1}}{b d (n+2)}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {b (A (n+2)+C (n+1)) \int \left (b \sin \left (c+d x+\frac {\pi }{2}\right )\right )^ndx+B (n+2) \int \left (b \sin \left (c+d x+\frac {\pi }{2}\right )\right )^{n+1}dx}{b (n+2)}+\frac {C \sin (c+d x) (b \cos (c+d x))^{n+1}}{b d (n+2)}\)

\(\Big \downarrow \) 3122

\(\displaystyle \frac {-\frac {(A (n+2)+C (n+1)) \sin (c+d x) (b \cos (c+d x))^{n+1} \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {n+1}{2},\frac {n+3}{2},\cos ^2(c+d x)\right )}{d (n+1) \sqrt {\sin ^2(c+d x)}}-\frac {B \sin (c+d x) (b \cos (c+d x))^{n+2} \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {n+2}{2},\frac {n+4}{2},\cos ^2(c+d x)\right )}{b d \sqrt {\sin ^2(c+d x)}}}{b (n+2)}+\frac {C \sin (c+d x) (b \cos (c+d x))^{n+1}}{b d (n+2)}\)

input
Int[(b*Cos[c + d*x])^n*(A + B*Cos[c + d*x] + C*Cos[c + d*x]^2),x]
 
output
(C*(b*Cos[c + d*x])^(1 + n)*Sin[c + d*x])/(b*d*(2 + n)) + (-(((C*(1 + n) + 
 A*(2 + n))*(b*Cos[c + d*x])^(1 + n)*Hypergeometric2F1[1/2, (1 + n)/2, (3 
+ n)/2, Cos[c + d*x]^2]*Sin[c + d*x])/(d*(1 + n)*Sqrt[Sin[c + d*x]^2])) - 
(B*(b*Cos[c + d*x])^(2 + n)*Hypergeometric2F1[1/2, (2 + n)/2, (4 + n)/2, C 
os[c + d*x]^2]*Sin[c + d*x])/(b*d*Sqrt[Sin[c + d*x]^2]))/(b*(2 + n))
 

3.4.72.3.1 Defintions of rubi rules used

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3122
Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[Cos[c + d*x]*(( 
b*Sin[c + d*x])^(n + 1)/(b*d*(n + 1)*Sqrt[Cos[c + d*x]^2]))*Hypergeometric2 
F1[1/2, (n + 1)/2, (n + 3)/2, Sin[c + d*x]^2], x] /; FreeQ[{b, c, d, n}, x] 
 &&  !IntegerQ[2*n]
 

rule 3227
Int[((b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_) + (d_.)*sin[(e_.) + (f_.)*(x 
_)]), x_Symbol] :> Simp[c   Int[(b*Sin[e + f*x])^m, x], x] + Simp[d/b   Int 
[(b*Sin[e + f*x])^(m + 1), x], x] /; FreeQ[{b, c, d, e, f, m}, x]
 

rule 3502
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*sin[(e_.) 
+ (f_.)*(x_)] + (C_.)*sin[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[(-C)*Co 
s[e + f*x]*((a + b*Sin[e + f*x])^(m + 1)/(b*f*(m + 2))), x] + Simp[1/(b*(m 
+ 2))   Int[(a + b*Sin[e + f*x])^m*Simp[A*b*(m + 2) + b*C*(m + 1) + (b*B*(m 
 + 2) - a*C)*Sin[e + f*x], x], x], x] /; FreeQ[{a, b, e, f, A, B, C, m}, x] 
 &&  !LtQ[m, -1]
 
3.4.72.4 Maple [F]

\[\int \left (\cos \left (d x +c \right ) b \right )^{n} \left (A +B \cos \left (d x +c \right )+C \left (\cos ^{2}\left (d x +c \right )\right )\right )d x\]

input
int((cos(d*x+c)*b)^n*(A+B*cos(d*x+c)+C*cos(d*x+c)^2),x)
 
output
int((cos(d*x+c)*b)^n*(A+B*cos(d*x+c)+C*cos(d*x+c)^2),x)
 
3.4.72.5 Fricas [F]

\[ \int (b \cos (c+d x))^n \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \, dx=\int { {\left (C \cos \left (d x + c\right )^{2} + B \cos \left (d x + c\right ) + A\right )} \left (b \cos \left (d x + c\right )\right )^{n} \,d x } \]

input
integrate((b*cos(d*x+c))^n*(A+B*cos(d*x+c)+C*cos(d*x+c)^2),x, algorithm="f 
ricas")
 
output
integral((C*cos(d*x + c)^2 + B*cos(d*x + c) + A)*(b*cos(d*x + c))^n, x)
 
3.4.72.6 Sympy [F]

\[ \int (b \cos (c+d x))^n \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \, dx=\int \left (b \cos {\left (c + d x \right )}\right )^{n} \left (A + B \cos {\left (c + d x \right )} + C \cos ^{2}{\left (c + d x \right )}\right )\, dx \]

input
integrate((b*cos(d*x+c))**n*(A+B*cos(d*x+c)+C*cos(d*x+c)**2),x)
 
output
Integral((b*cos(c + d*x))**n*(A + B*cos(c + d*x) + C*cos(c + d*x)**2), x)
 
3.4.72.7 Maxima [F]

\[ \int (b \cos (c+d x))^n \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \, dx=\int { {\left (C \cos \left (d x + c\right )^{2} + B \cos \left (d x + c\right ) + A\right )} \left (b \cos \left (d x + c\right )\right )^{n} \,d x } \]

input
integrate((b*cos(d*x+c))^n*(A+B*cos(d*x+c)+C*cos(d*x+c)^2),x, algorithm="m 
axima")
 
output
integrate((C*cos(d*x + c)^2 + B*cos(d*x + c) + A)*(b*cos(d*x + c))^n, x)
 
3.4.72.8 Giac [F]

\[ \int (b \cos (c+d x))^n \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \, dx=\int { {\left (C \cos \left (d x + c\right )^{2} + B \cos \left (d x + c\right ) + A\right )} \left (b \cos \left (d x + c\right )\right )^{n} \,d x } \]

input
integrate((b*cos(d*x+c))^n*(A+B*cos(d*x+c)+C*cos(d*x+c)^2),x, algorithm="g 
iac")
 
output
integrate((C*cos(d*x + c)^2 + B*cos(d*x + c) + A)*(b*cos(d*x + c))^n, x)
 
3.4.72.9 Mupad [F(-1)]

Timed out. \[ \int (b \cos (c+d x))^n \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \, dx=\int {\left (b\,\cos \left (c+d\,x\right )\right )}^n\,\left (C\,{\cos \left (c+d\,x\right )}^2+B\,\cos \left (c+d\,x\right )+A\right ) \,d x \]

input
int((b*cos(c + d*x))^n*(A + B*cos(c + d*x) + C*cos(c + d*x)^2),x)
 
output
int((b*cos(c + d*x))^n*(A + B*cos(c + d*x) + C*cos(c + d*x)^2), x)